Conversation
| <source>${maven.compiler.source}</source> | ||
| <target>${maven.compiler.target}</target> | ||
| <testSource>${maven.compiler.testSource}</testSource> | ||
| <testTarget>${maven.compiler.testTarget}</testTarget> |
There was a problem hiding this comment.
The parent pom should not be setting these to 1.5. Instead, it should define these properties to 1.5, allowing child poms to override them, without having to redefine the plugin.
|
|
||
| final StructFieldDescription desc = new StructFieldDescription(); | ||
| Method setter; | ||
| ResolvedMember resolvedSetter; |
There was a problem hiding this comment.
This type should be ResolvedMethod. Also, it would greatly simplify the code base if this was a final field, and it was some type of Consumer<?>. Not sure about performance impact with that.
| } | ||
|
|
||
| @Deprecated | ||
| protected static boolean acceptFieldGetter(Member member, boolean getter) { |
There was a problem hiding this comment.
Remove this, dead code.
| if (acceptFieldGetter(method, true)) { | ||
| StructFieldDeclaration io = fromGetter(method); | ||
| try { | ||
| // this only works when the names are equal, does not support setXXX methods. |
There was a problem hiding this comment.
Add a test to show that this is broken and fix it.
| return list; | ||
| } | ||
|
|
||
| protected static List<StructFieldDeclaration> listFields2(Class<?> structClass) { |
There was a problem hiding this comment.
get this into a separate class, it does not belong here.
| } | ||
|
|
||
| protected static ResolvedTypeWithMembers resolveType( Class<?> structClass ) { | ||
| TypeResolver resolver = new TypeResolver(); |
There was a problem hiding this comment.
There should just be one of these.
| TypeResolver resolver = new TypeResolver(); | ||
| ResolvedType classType = resolver.resolve(structClass); | ||
| MemberResolver mr = new MemberResolver(resolver); | ||
| mr.setMethodFilter(new Filter<RawMethod>() { |
| !method.isStatic(); | ||
| } | ||
| }); | ||
| mr.setFieldFilter(new Filter<RawField>() { |
| } | ||
|
|
||
| @Deprecated | ||
| protected static StructFieldDeclaration fromField(java.lang.reflect.Field getter) { |
| } | ||
|
|
||
| @Deprecated | ||
| protected static StructFieldDeclaration fromGetter(Method getter) { |
There was a problem hiding this comment.
Dead code, remove.
| } | ||
|
|
||
| @Deprecated | ||
| private static StructFieldDeclaration fromMember(Member member) { |
There was a problem hiding this comment.
Dead code, remove.
| return mr.resolve(classType, annConfig, null); | ||
| } | ||
|
|
||
| protected static <T extends Member> void updateDecl(StructFieldDeclaration decl, ResolvedMember<T> member ) { |
There was a problem hiding this comment.
Is this dead code? There is another version below.
| ResolvedType rt = (ResolvedType)tpe; | ||
| // TODO: what do we do here? | ||
| ret = tpe; | ||
| } |
There was a problem hiding this comment.
Can this actually be anything other than ResolvedType now?
| field.desc.nativeTypeOrPointerTargetType = tpe; | ||
| } | ||
| } | ||
| else if(field.desc.valueType instanceof ParameterizedType) { |
There was a problem hiding this comment.
This should be dead code.
| @SuppressWarnings("deprecation") | ||
| protected static void computeStructLayout(StructDescription desc, StructCustomizer customizer) { | ||
| List<StructFieldDeclaration> fieldDecls = StructFieldDeclaration.listFields(desc.structClass); | ||
| List<StructFieldDeclaration> fieldDecls = StructFieldDeclaration.listFields2(desc.structClass); |
There was a problem hiding this comment.
Fix this name after removing original implementation.
| public void testPointerTo_${prim.Name}_Values() { | ||
| // Test pointerToInts(int...) | ||
| Pointer<${prim.rawTypeRef}> p = Pointer.pointerTo${prim.CapName}s(${prim.value($v1)}, ${prim.value($v2)}, ${prim.value($v3)}); | ||
| Pointer<${rawTypeRef}> p = Pointer.pointerTo${prim.CapName}s(${prim.value($v1)}, ${prim.value($v2)}, ${prim.value($v3)}); |
There was a problem hiding this comment.
The changes here fix generic usage and are not changes to functionality.
| @Test | ||
| public void testPointerTo_${prim.Name}_Value() { | ||
| Pointer<${prim.rawTypeRef}> p = Pointer.pointerTo${prim.CapName}(${prim.value($v1)}); | ||
| Pointer<${rawTypeRef}> p = Pointer.pointerTo${prim.CapName}(${prim.value($v1)}); |
There was a problem hiding this comment.
The changes here fix generic usage and are not changes to functionality.
f713cba to
2736544
Compare
2736544 to
07a9235
Compare
renamed resolution method to origin name
|
I scanned the code base for ParameterizedType and attempted to remove it. There is still a lot of resolution code happening in CRuntime and its subclasses. I would like to remove ParameterizedType, TypeVariable, etc from the codebase, to make sure resolution is consistent, but it may need to happen over several PRs. |
NOTE: This PR is not complete, but the test suite is passing. Looking for feedback. Also, it is based on #90, so that should be merged before this PR, or this PR should be rebased.
This PR aims to rework type resolution in BridJ, so that resolution code is off loaded to a third party library and to support more complex generics in classes extending StructObject. Once merged, the following struct will work with BridJ:
Status: Code to support generic resolution has been introduced and a test called StructGenericsTest has been added to verify that structures of this type now work.
TODO: Remove dead code dealing directly with Java's type classes.
Build Changes:
Fixes #59